#####################################################################
# Product:      KnowledgeEngine (Plone Edition)
#
# File:         Entity.py
#
# Copyright:    Copyright (c) 2006, Faulkner Technologies
#
# Author:       Brian Oliver
#
# Description:  A KnowledgeEngine 'Entity' encapsulates the attributes
#               for a single entity provided by an EntitySource
#
# See Also:     EntitySource
#####################################################################

#####################################################################
## KnowledgeEngine Library Imports
from Common import *

#####################################################################
## Zope Library Imports
from Globals import InitializeClass
from AccessControl import ClassSecurityInfo
from AccessControl.Role import RoleManager
 
#####################################################################
## Python Library Imports
# (none)

#####################################################################
## Entity Class Definition
class Entity(RoleManager):
    """
        An object to hold transitent Entity information.
        
        Created by an EntitySource
    """


    #---------------------------------------------------------------#
    # Declare security so ClassInfo may be accessed in DTML/ZPT etc
    security = ClassSecurityInfo()
    security.declareObjectPublic()
    security.setDefaultAccess("allow")


    #---------------------------------------------------------------#
    def __init__(self, identity, title, data = {}):
        """
            All entities have an identity and a displayable title.
        """
        
        self.identity   = identity
        self.title      = title
        self.data       = data


    #---------------------------------------------------------------#
    def getIdentity(self):
        """
            Returns the unique identity for the entity
            
            RETURN TYPE: String
        """
        
        return self.identity


    #---------------------------------------------------------------#
    def getTitle(self):
        """
            Returns the title for the entity
            
            RETURN TYPE: String
        """
        
        return self.title


    #---------------------------------------------------------------#
    def getData(self):
        """
            Returns the entity data
            
            RETURN TYPE: Dictionary
        """

        return self.data


#####################################################################
## Class Initialisation
InitializeClass(Entity)
